﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace CookingTrans
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length == 4)
            {
                string sourceFile;
                string destiDir;
                if (args[0] == "-s" && args[2] == "-d")
                {
                    sourceFile = args[1];
                    destiDir = args[3];
                }
                else if (args[2] == "-s" && args[0] == "-d")
                {
                    sourceFile = args[3];
                    destiDir = args[1];
                }
                else
                {
                    Console.WriteLine("Error in Console arguments!");
                    return;
                }
                if (File.Exists(sourceFile))
                {
                    if (Rapi.RapiInitEx())
                    {
                        Rapi.CopyToRemoteFile(sourceFile, destiDir);
                        Rapi.RapiUnInit();
                    }
                }
                else
                {
                    Console.WriteLine("Cooking plan does not exist!");
                }
            }
            else
            {
                Console.WriteLine("Error in Console arguments!");
                return;
            }
        }
    }
}
